if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PreservationNoticeHistoryGetUnconfirmedByNewSite]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[PreservationNoticeHistoryGetUnconfirmedByNewSite]
GO

CREATE PROCEDURE dbo.PreservationNoticeHistoryGetUnconfirmedByNewSite
(
	@RowCount int,
	@NewSiteID uniqueidentifier
)
AS

IF @RowCount > 0 SET ROWCOUNT @RowCount

SELECT
	*
FROM 
	PreservationNoticeHistory
WHERE
	NewSiteID = @NewSiteID
	AND 
	(DateEmailMessageSent IS NULL) AND (VerificationTries < 25)
	--AND
	--PreservationNoticeHistoryID NOT IN (SELECT PreservationNoticeHistoryID FROM inetlog WHERE PreservationNoticeHistoryID IS NOT NULL)
GO